"use strict";

module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER } = Sequelize;
    await queryInterface.createTable("role_menu", {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      role_id: {
        type: INTEGER,
        allowNull: false,
        references: {
          model: "role",
          key: "id",
        },
      },
      menu_id: {
        type: INTEGER,
        allowNull: false,
        references: {
          model: "menu",
          key: "id",
        },
      },
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable("role_menu");
  },
};
